/*
 *    Copyright (c) 2018-2025, proj All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the proj developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: proj
 */
package com.ykht.proj.coupon.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ykht.proj.coupon.Enum.TagStatus;
import com.ykht.proj.coupon.entity.FxCmsTag;
import com.ykht.proj.coupon.mapper.FxCmsTagMapper;
import com.ykht.proj.coupon.service.FxCmsTagService;
import com.ykht.proj.coupon.vo.FxCmsInfoCount;
import com.ykht.proj.coupon.vo.FxCmsTagCount;
import com.ykht.proj.coupon.vo.FxCmsTagVO;
import org.springframework.stereotype.Service;

/**
 * cms资讯标签
 *
 * @author proj code generator
 * @date 2021-02-01 16:22:52
 */
@Service
public class FxCmsTagServiceImpl extends ServiceImpl<FxCmsTagMapper, FxCmsTag> implements FxCmsTagService {

    @Override
    public IPage<FxCmsTagVO> queryByPage(Page page, FxCmsTagVO fxCmsTagVO) {
		IPage<FxCmsTagVO> iPage = new Page<>(page.getCurrent(),page.getSize());
		return this.baseMapper.queryByPage(iPage,fxCmsTagVO);
    }

	@Override
	public FxCmsTagCount queryCount(FxCmsTagVO fxCmsTagVO) {
		FxCmsTagCount fxCmsTagCount = new FxCmsTagCount();
		/*上架计数*/
		fxCmsTagCount.setPutAway(this.baseMapper.selectCount(TagStatus.TAG_STATUS_1.getValue(),fxCmsTagVO));
		/*下架计数*/
		fxCmsTagCount.setSoldOut(this.baseMapper.selectCount(TagStatus.TAG_STATUS_2.getValue(),fxCmsTagVO));
		return fxCmsTagCount;
	}
}
